 package handling.login.handler;

 import client.MapleCharacter;
 import client.MapleCharacterUtil;
 import client.MapleClient;
 import client.inventory.Item;
 import client.inventory.MapleInventoryType;
 import client.skills.SkillEntry;
 import constants.JobConstants;
 import handling.login.JobType;
 import handling.login.LoginInformationProvider;
 import handling.world.WorldBroadcastService;
 import java.util.HashMap;
 import java.util.Map;
 import server.MapleItemInformationProvider;
 import server.quest.MapleQuest;
 import tools.MaplePacketCreator;
 import tools.data.input.LittleEndianAccessor;










 public class CreateUltimateHandler
 {
   public static void handlePacket(LittleEndianAccessor slea, MapleClient c) {
/*  32 */     if (!c.isLoggedIn() || c.getPlayer() == null || c.getPlayer().getLevel() < 120 || c.getPlayer().getQuestStatus(20734) != 0 || c.getPlayer().getQuestStatus(20616) != 2 || !JobConstants.is骑士团(c.getPlayer().getJob())) {
/*  33 */       c.getPlayer().dropMessage(1, "建立终极冒险家失败：\r\n1.等级不够120级\r\n2.任务未完成\r\n3.职业不是骑士团职业\r\n4.已创建过终极冒险家的角色");
/*  34 */       c.announce(MaplePacketCreator.createUltimate(1));
       return;
     }
/*  37 */     if (!c.canMakeCharacter(c.getPlayer().getWorld())) {
/*  38 */       c.announce(MaplePacketCreator.createUltimate(2));
       return;
     }
/*  41 */     String name = slea.readMapleAsciiString();
/*  42 */     int job = slea.readInt();

/*  44 */     int face = slea.readInt();
/*  45 */     int hair = slea.readInt();





/*  51 */     slea.skip(16);
/*  52 */     int weapon = slea.readInt();
/*  53 */     if (job == 110 || job == 120) {
/*  54 */       weapon = 1402092;
/*  55 */     } else if (job == 130) {
/*  56 */       weapon = 1432082;
/*  57 */     } else if (job == 210 || job == 220 || job == 230) {
/*  58 */       weapon = 1372081;
/*  59 */     } else if (job == 310) {
/*  60 */       weapon = 1452108;
/*  61 */     } else if (job == 320) {
/*  62 */       weapon = 1462095;
/*  63 */     } else if (job == 410) {
/*  64 */       weapon = 1472119;
/*  65 */     } else if (job == 420) {
/*  66 */       weapon = 1332127;
/*  67 */     } else if (job == 510) {
/*  68 */       weapon = 1482081;
/*  69 */     } else if (job == 520) {
/*  70 */       weapon = 1492082;
     } else {
/*  72 */       c.getPlayer().dropMessage(1, "建立终极冒险家失败，职业ID: " + job + " 不正确。");
/*  73 */       c.announce(MaplePacketCreator.createUltimate(1));

       return;
     }
/*  77 */     byte gender = c.getPlayer().getGender();

/*  79 */     JobType jobType = JobType.终极冒险家;
/*  80 */     MapleCharacter newchar = MapleCharacter.getDefault(c, jobType);
/*  81 */     newchar.setJob(job);
/*  82 */     newchar.setWorld(c.getPlayer().getWorld());
/*  83 */     newchar.setFace(face);
/*  84 */     newchar.setHair(hair);
/*  85 */     newchar.setGender(gender);
/*  86 */     newchar.setName(name);
/*  87 */     newchar.setSkinColor((byte)3);
/*  88 */     newchar.setLevel((short)50);
/*  89 */     (newchar.getStat()).str = 4;
/*  90 */     (newchar.getStat()).dex = 4;
/*  91 */     (newchar.getStat()).int_ = 4;
/*  92 */     (newchar.getStat()).luk = 4;
/*  93 */     newchar.setRemainingAp((short)254);
/*  94 */     newchar.setRemainingSp((job / 100 == 2) ? 128 : 122);
/*  95 */     (newchar.getStat()).maxhp += 150;
/*  96 */     (newchar.getStat()).maxmp += 125;
/*  97 */     switch (job) {
       case 110:
       case 120:
       case 130:
/* 101 */         (newchar.getStat()).maxhp += 600;
/* 102 */         (newchar.getStat()).maxhp += 2000;
/* 103 */         (newchar.getStat()).maxmp += 200;
         break;
       case 210:
       case 220:
       case 230:
/* 108 */         (newchar.getStat()).maxmp += 600;
/* 109 */         (newchar.getStat()).maxhp += 500;
/* 110 */         (newchar.getStat()).maxmp += 2000;
         break;
       case 310:
       case 320:
       case 410:
       case 420:
       case 520:
/* 117 */         (newchar.getStat()).maxhp += 500;
/* 118 */         (newchar.getStat()).maxmp += 250;
/* 119 */         (newchar.getStat()).maxhp += 900;
/* 120 */         (newchar.getStat()).maxmp += 600;
         break;
       case 510:
/* 123 */         (newchar.getStat()).maxhp += 500;
/* 124 */         (newchar.getStat()).maxmp += 250;
/* 125 */         (newchar.getStat()).maxhp += 450;
/* 126 */         (newchar.getStat()).maxmp += 300;
/* 127 */         (newchar.getStat()).maxhp += 800;
/* 128 */         (newchar.getStat()).maxmp += 400;
         break;
       default:
         return;
     }
/* 133 */     for (int i = 2490; i < 2507; i++) {
/* 134 */       newchar.setQuestAdd(MapleQuest.getInstance(i), (byte)2, null);
     }
/* 136 */     newchar.setQuestAdd(MapleQuest.getInstance(29947), (byte)2, null);
/* 137 */     newchar.setQuestAdd(MapleQuest.getInstance(111111), (byte)0, c.getPlayer().getName());

/* 139 */     Map<Integer, SkillEntry> sDate = new HashMap<>();
/* 140 */     sDate.put(Integer.valueOf(1074 + job / 100), new SkillEntry(5, (byte)5, -1L));
/* 141 */     sDate.put(Integer.valueOf(80), new SkillEntry(1, (byte)1, -1L));
/* 142 */     newchar.changeSkillLevel_Skip(sDate, false);

/* 144 */     MapleItemInformationProvider li = MapleItemInformationProvider.getInstance();
/* 145 */     int[] items = { 1142257, 1003159, 1052304, 1082290, 1072476, weapon }; byte b1;
/* 146 */     for (b1 = 0; b1 < items.length; b1 = (byte)(b1 + 1)) {
/* 147 */       Item item = li.getEquipById(items[b1]);
/* 148 */       item.setPosition((short)(byte)(b1 + 1));
/* 149 */       newchar.getInventory(MapleInventoryType.EQUIP).addFromDB(item);
     }
/* 151 */     newchar.getInventory(MapleInventoryType.USE).addItem(new Item(2000004, (short)0, (short)100, (short)0));
/* 152 */     newchar.getInventory(MapleInventoryType.USE).addItem(new Item(2000004, (short)0, (short)100, (short)0));
/* 153 */     c.getPlayer().fakeRelog();
/* 154 */     if (MapleCharacterUtil.canCreateChar(name, c.isGm()) && (!LoginInformationProvider.getInstance().isForbiddenName(name) || c.isGm())) {
/* 155 */       MapleCharacter.saveNewCharToDB(newchar, jobType, (short)0, true);
/* 156 */       MapleQuest.getInstance(20734).forceComplete(c.getPlayer(), 1101000);
/* 157 */       c.announce(MaplePacketCreator.createUltimate(0));
/* 158 */       WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.serverNotice(6, "[系统公告] 恭喜玩家 " + c.getPlayer().getName() + " 创建了终极冒险家。"));
     } else {
/* 160 */       c.announce(MaplePacketCreator.createUltimate(3));
     }
   }
 }


/* Location:              C:\PGX\Server.jar!\handling\login\handler\CreateUltimateHandler.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */